<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>小天使考试</title>
    <script src="./lib/jquery.js"></script>
    <style>
            img{
          width: 50px;
          height: 50px;
          position: absolute;
      }

    </style>
  </head>

  <body>
    <img src="./angel.gif" alt="" class="img" >
   
  </body>
</html>
<script>
  
  // 获取图片
  var img=document.querySelector("img")

// 节流
var flag=true;
img.onmousemove=function(){
    if(flag){
        flag=false;
        console.log('111');
        setTimeout(()=>{
            flag=true;
        },200)
    }
}

  document.addEventListener('mousemove',function(e){
            var x = e.pageX;
            var y = e.pageY;
            img.style.left = x-25 + 'px';
            img.style.top = y-25 + 'px';
        })










</script>
